import { http } from "@/utils/http";

export const useCommentAPI = () => {
  // 获取歌曲评论
  const getCommentByMusicId = (musicId: string): any => {
    return http.get(`/comment/getCommentByMusicId?musicId=${musicId}`);
  };

  // 获取歌单评论
  const getCommentByListId = (playlistId: string): any => {
    return http.get(`/comment/getCommentByPlaylistId?playlistId=${playlistId}`);
  };

  // 发布评论
  const addComment = (data: any): any => {
    return http.post("/comment/add", data);
  };

  // 回复评论
  const replyComment = (data: any): any => {
    return http.post("/comment/add", data);
  };

  // 获取歌手评论
  const getCommentBySingerId = (singerId: string): any => {
    return http.get(`/comment/getCommentBySingerId?singerId=${singerId}`);
  };

  return {
    getCommentByMusicId,
    addComment,
    getCommentByListId,
    getCommentBySingerId, // 添加到返回对象中
  };
};
